# case "$(file -Lb --mime-type -- "$1")" in
#  ...
#  ...
#     *text/plain*|*text/x-shellscript*)
#         # return false to always repaint, in case terminal size changes
#         bat --force-colorization --paging=never --style=changes,numbers \
#             --terminal-width $(($2 - 3)) "$1" && false
#         ;;
#     *image/*)
#         chafa -f sixel -s "$2x$3" --animate off --polite on "$1"
#         exit 1
#         ;;
#     *)
#         echo "unknown format"
#         ;;
# esac
#
#

case "$(file -Lb --mime-type -- "$1")" in
 ...
 ...
    *text/plain*|*text/x-shellscript*)
        # return false to always repaint, in case terminal size changes
        bat --force-colorization --paging=never --style=changes,numbers \
            --terminal-width $(($2 - 3)) "$1" && false
        ;;
    *image/*)
        chafa -f sixel -s "$2x$3" --animate off --polite on "$1"
        exit 1
        ;;
    *)
        echo "unknown format"
        ;;
esac
